#include"speech_server/Communication.h"
//#include <QByteArray>
////#include <QApplication>
//void Communication::connect()
//{
//    socket->connectToHost(host,port);
//    qDebug()<<host<<" "<<port;
//    is_closed=false;
//    //QApplication::exit();
//}
//bool Communication::bind()
//{

//    qDebug()<<"bind"<<host<<" "<<port;
//    is_closed=false;
//    return socket->bind(port);

//}

//std::string Communication::Recieve()
//{


//    //while(socket.pendingDatagramSize()<=0 && ros::ok());
//    std::string buffer;//="";
///*    while(*/socket->waitForReadyRead(INT_MAX);
////    {
//    qDebug()<<1;
//        while(socket->hasPendingDatagrams())
//        {
//            qDebug()<<2;
//            QByteArray *byteArray = new QByteArray();
//            qDebug()<<3;
//            byteArray->resize(socket->pendingDatagramSize());
//            qDebug()<<4;
//            socket->readDatagram(byteArray->data(),byteArray->size());
//            buffer.append(byteArray->data());
//        }
// //   }
//    return buffer;
//}
//void Communication::close()
//{
//    socket->close();
//    is_closed=true;
//}

//void Communication::Send(std::string str)
//{
//    socket->writeDatagram(str.c_str(),(qint64)511,host,port);
//}
//int Communication::PendingData()
//{
//    return socket->pendingDatagramSize();
//}
